package com.kumi.blog.user.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.kumi.blog.user.bean.UserEncryptedRelation;
import com.kumi.blog.user.service.UserEncryptedRelationService;
import com.kumi.common.utils.PageUtils;
import com.kumi.common.utils.R;



/**
 * 用户密保中间表
 *
 * @author kumi
 * @email 1971240051@qq.com
 * @date 2022-06-04 03:21:44
 */
@RestController
@RequestMapping("user/userencryptedrelation")
public class UserEncryptedRelationController {
    @Autowired
    private UserEncryptedRelationService userEncryptedRelationService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("user:userencryptedrelation:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = userEncryptedRelationService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{urId}")
    //@RequiresPermissions("user:userencryptedrelation:info")
    public R info(@PathVariable("urId") Integer urId){
		UserEncryptedRelation userEncryptedRelation = userEncryptedRelationService.getById(urId);

        return R.ok().put("userEncryptedRelation", userEncryptedRelation);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("user:userencryptedrelation:save")
    public R save(@RequestBody UserEncryptedRelation userEncryptedRelation){
		userEncryptedRelationService.save(userEncryptedRelation);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("user:userencryptedrelation:update")
    public R update(@RequestBody UserEncryptedRelation userEncryptedRelation){
		userEncryptedRelationService.updateById(userEncryptedRelation);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("user:userencryptedrelation:delete")
    public R delete(@RequestBody Integer[] urIds){
		userEncryptedRelationService.removeByIds(Arrays.asList(urIds));

        return R.ok();
    }

}
